<!DOCTYPE html>
<html>
  <head>
  <meta charset="UTF-8" />
  <link rel="stylesheet" href="/bootstrap.min.css">
  <script src="/jquery.min.js"></script>
  <script src="/bootstrap.min.js"></script>
  <script type="text/javascript" src="/jschannel.js"></script>
<style type="text/css">
.failed {
    background-color: #FF3333;
}
.error {
    color: #FF3333;
}
table {
    font-family: Monaco, Consolas, monospace;
}
</style>
<script type="text/javascript" src="upload.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        setTimeout(function() {
            var _chan = Channel.build({window: window.parent, origin: "*", scope: "ItemScope"});
            _chan.call({
                method: "getProblemID",
                params: "",
                success: function(v) {
                    $('#author').val(v.author);
                }
            });
        }, 1500);
    });
</script>
</head>
<body>
<div class="container">
<h2><center>欢迎使用在线 Verilog 测试平台</center></h2>
<div class="row">
<div class="col-md-3 col-sm-3"></div>
<div class="col-md-3 col-sm-3">
<form role="form" method="post" action="/submit.php" enctype="multipart/form-data" onsubmit="fileUpload(this, this.action); return false;">
  <div class="form-group">
    <label for="inputfile">代码上传</label>
    <input type="file" name="file_upload" id="inputfile">
    <input type="hidden" name="author" id="author">
    <p id="error" class="error"></p>
  </div>
  <button type="submit" class="btn btn-default" id="submit-code">提交</button>
<script type="text/javascript">
$('#inputfile').bind('change', function() {
    $('#result_summary').html("");
    $('#result_detail').html("");
    if (this.files[0].size > 0x10000) {
        $('#error').html("文件过大(大于64KB)，请按要求重新上传");
        $('#submit-code').attr('disabled','disabled');
    }
    else {
        $('#error').html("");
        $('#submit-code').removeAttr('disabled');
    }
});
</script>
</form>
</div>
<div class="col-md-1 col-sm-1"></div>
<div id="result_summary" class="col-md-3 col-sm-3"></div>
<div class="col-md-1 col-sm-1"></div>
</div>
<div class="row">
<div class="col-md-12 col-sm-12" id="result_detail"></div>
</div>
</div>
</body>
</html>
